<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function fun(name,age,gender){
            var obj ={
                name:name,
                age:age,
                gender:gender,
                sayName:function(){
                    console.log(this.name)
                }
            }
            return obj;
        }

        var result1 = fun('苏凉',20,'男');
        var result2 = fun('小明',18,'男');
        var result3 = fun('小丽',21,'女');

        console.log(result1);
        console.log(result2);
        console.log(result3);

        result1.sayName();
        result2.sayName();
        result3.sayName();

        // var result1 = {
        //     age: 20,
        //     gender: "男",
        //     name: "苏凉",
        //     sayName:function(){
        //         console.log(this.name)
        //     }
        // }
        // var result2 = {
        //     age: 18,
        //     gender: "男",
        //     name: "小明",
        //     sayName:function(){
        //         console.log(this.name)
        //     }
        // }
        // var result3 = {
        //     age: 21,
        //     gender: "女",
        //     name: "小丽",
        //     sayName:function(){
        //         console.log(this.name)
        //     }
        // }
        //  console.log(result1);
        //  console.log(result2);
        //  console.log(result3);
        //  result1.sayName();
        //  result2.sayName();
        //  result3.sayName();
    </script>
</head>
<body>
    
</body>
</html>